<?php
namespace Home\Model;
use Think\Model;

class AlipayModel extends Model {
    // 自动验证设置
    protected $_validate = array(

    array('name','require','姓名必须！'), //默认情况下用正则进行验证
    array('alipay','','该银行卡号已经绑定过了',0,'unique',1), // 在新增的时候验证name字段是否唯一
    ); 

   public function chaxun($user)
   {
   	return $this->where('qid='.$user)->select();
   }
   public function addcard()
   {
    if ($vo = $this->create()) { 
            $list = $this->add();
            if ($list !== false) {   
                    echo "<script>
                           history.go(-2);
                          </script>";

            } else {
                  echo "<script>
                            alert('添加失败');
                           history.go(-2);
                          </script>";;
            }
        } else {
           $er= $this->getError();
                            echo "<script>
                            alert('{$er}');
                           history.go(-2);
                          </script>";;
          
        }     

   }

}